package org.vnl.platform.service.rule;

import org.vnl.platform.dk.util.PDKException;
import org.vnl.platform.dk.util.PDKRuntimeException;

/**
 * 規則執行時若有錯誤時,會拋出些Exception
 * 
 * @author Vaughan
 *
 */
public class RuleException extends PDKException {

    private static final String SYSTEM_ID = "PDKRULE";
    public static final String DEFAULT_BUNDLE_NAME = "resource.org.vnl.platform.service.Rule";
    
    public RuleException(RuleErrCode code) {
        super(SYSTEM_ID,code.toString(),code.getSeverityString(), null, null);
    }

    public RuleException(RuleErrCode code, Object[] parameters) {
        super(SYSTEM_ID,code.toString(),code.getSeverityString(), parameters, null);
    }

    public RuleException(RuleErrCode code, Throwable cause) {
        super(SYSTEM_ID,code.toString(),code.getSeverityString(), null, cause);
    }
    
    public RuleException(RuleErrCode code, Object[] parameters, Throwable cause) {
        super(SYSTEM_ID,code.toString(),code.getSeverityString(), parameters, cause);
    }

    public RuleException(PDKException e) {
        super(e.getSystemId(),e.getMessage(),e.getSeverity(),e.getParameters(),e);
    }

    public RuleException(PDKRuntimeException e) {
        super(e.getSystemId(),e.getMessage(),e.getSeverity(),e.getParameters(),e);
    }
    
    /**
     * 
     */
    private static final long serialVersionUID = 3397650573152366249L;

    @Override
    protected String getDefaultBundleName() {
        return DEFAULT_BUNDLE_NAME;
    }

}
